 <template>
  <!--合同 详细内容页面 -->
  <div id="container">
    <el-collapse v-model="activeNames" v-loading="loading">
      <el-collapse-item title="" name="1">
        <contract-detail ref="contractDetail"></contract-detail>
      </el-collapse-item>
      <el-collapse-item title="" name="2">
        <contract-data ref="contractData" :data="contractAll"></contract-data>
      </el-collapse-item>
      <el-collapse-item title="审批流程" name="2">
        <check-process
          ref="checkProcess"
          :id="$route.query.id"
          :type="2"
        ></check-process>
      </el-collapse-item>
    </el-collapse>
    <auth-buttons
      :info="{ type: 2, mainId: $route.query.id }"
      @updatePage="updatePage"
    ></auth-buttons>
  </div>
</template>
<script>

import contractDetail from './components/contractDetail.vue'
import contractData from './components/contractData.vue'
import checkProcess from '@/components/checkProcess/checkList'
import authButtons from '@/components/authButtons'
export default {
  name: 'detail',
  data () {

    return {
      activeNames: ['1', '2',],
      checkCofig: [],
      contractAll: {},//合同详细信息
      title: '',
      time: '',//合同创建时间
      contractUser: '',//合同创建人
      loading: false
    }
  },
  components: {
    contractDetail,
    contractData,
    checkProcess,
    authButtons
  },
  mounted () {
    this.getDetail()
  },
  methods: {
    async getDetail () {
      this.loading = true
      let { data } = await this.$API.contract.getContractById.post({ id: this.$route.query.id })
      this.loading = false
      this.$refs.contractDetail.provideForm = data.customerData
      this.$refs.contractDetail.lessorArticle = data.lessorArticle
      this.$refs.contractDetail.quotesData = data.quotesData
      this.$refs.contractDetail.needForm = data.contractFit
      console.log(this.$refs.contractDetail.needForm)
      this.$refs.contractDetail.contactData = data
      this.contractAll = data
      this.activeNames.push('3')
    },
    updatePage () {
      this.getDetail()
      this.$refs.contractData.relodPart()
      this.$refs.checkProcess.relodPart()
    }
  }
}
</script>
<style lang='scss' scoped>
#container {
  margin: 10px;
  :deep(.el-collapse-item__header) {
    padding-left: 20px;
    font-size: 16px;
  }
  :deep(.el-collapse-item__content) {
    padding: 0 20px 20px 20px;
  }
  :deep(.el-form-item) {
    margin-bottom: 5px;
  }
  :deep(.el-form-item__label) {
    color: #999;
  }

  .itemClass {
    :deep(.el-collapse-item__header) {
      font-weight: 600;
    }
  }
}
</style>